{% extends "./inc_base.html" %}
{% block middle %}
<!-- start :: blog content -->
<div class="section pt-4">
    <div class="container">

        <div class="row g-xl-5">

            <div class="col-lg-9 order-2">

                <div class="mb-4">
                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb small mb-3">
                            {%for item in breadcrumb%}
                            <li class="breadcrumb-item"><a href="{{item.url}}">{{item.name}}</a></li>
                            {%endfor%}
                            <li class="breadcrumb-item">详情</li>
                        </ol>
                    </nav>
                    <h1 class="h3 mb-0">
                        {{detail.title}}
                    </h1>
                    <p class="d-block text-muted small">
                        发布时间: <time
                            datetime="{{helper.moment(detail.createdAt).format('YYYY-MM-DD HH:mm:ss')}}">{{helper.moment(detail.createdAt).format('YYYY-MM-DD
                            HH:mm:ss')}}</time>
                    </p>

                </div>
                {%if detail.models_uuid==='e86401ba-85cb-47f7-9f53-853e26b939bd'%}
                <div class="article-format">
                    {{detail.cms_doc_article.content|safe}}
                </div>
                {%elif detail.models_uuid==='4e0da60c-13af-4965-8f35-e2b13742398e'%}
                <!--
						In order for lazyload to work, a height is required, else all images are in viewport.
						By default, an empty png is set with 300px height:
						http://png-pixel.com/
					-->
                <div class="row">
                    {% for item in detail.cms_doc_picture.content%}
                    <div class="col-6 col-lg-4 mb-3">

                        <div class="bg-white p-2 shadow-primary-xs transition-hover-top transition-all-ease-250">
                            <a href="{{item.url}}" data-fancybox="gallery"
                                class="fancybox fancybox-primary d-block overflow-hidden overlay-dark-hover overlay-opacity-2 text-decoration-none text-dark">
                                <img class="img-fluid lazy rounded" data-src="{{item.url}}" src="" alt="...">
                            </a>
                            <div class="p-2">
                                <h6 class="m-0">
                                    {{item.desc}}
                                </h6>
                            </div>
                        </div>

                    </div>
                    {%endfor%}
                </div>

                {%elif detail.models_uuid==='aac4b5a3-89f2-4c41-9213-39f43dcc0860'%}

                <div class="row">
                    <div class="col mb-3">
                        {%if detail.cover_url%}
                        <figure class="mb-3">
                            <img class="img-fluid" src="{{detail.cover_url}}" alt="...">
                        </figure>
                        {%endif%}
                        {%if detail.cms_doc_download.desc%}
                        {{detail.cms_doc_download.desc|safe}}
                        {%endif%}
                    </div>
                    <div class="col-12 col-lg-3 mb-3 ">
                        <!-- specifications -->
                        <div class="sticky-kit z-index-0 bg-w">
                            <div class="card">
                                <div class="card-body">
                                    <h3 class="h5">
                                        下载列表
                                    </h3>

                                    <!-- specs list -->
                                    <ul class="list-unstyled mb-0">
                                        {%for item in detail.cms_doc_download.content%}
                                        <li class="list-item clearfix border-bottom py-2">
                                            <a href="#" data-bs-toggle="modal" data-bs-target="#d-{{loop.index}}">
                                                <i class="fi {%if item.d_type==='1'%}fi-arrow-download{%else%}fi-cloud-download{%endif%} text-gray-400 fs-5"></i>
                                                <span class="d-inline-block px-2">{{item.d_title}}</span>
                                            </a>
                                        </li>
                                        {%endfor%}
                                    </ul>
                                    <!-- /specs list -->
                                </div>
                            </div>
                        </div>
                        {%for item in detail.cms_doc_download.content%}
                        <!-- Modal -->
                        <div class="modal fade" id="d-{{loop.index}}" data-bs-keyboard="false" tabindex="-1"
                            aria-labelledby="modalCenteredLabel" aria-hidden="true">
                            <div class="modal-dialog modal-dialog-centered">
                                <div class="modal-content">

                                    <div class="modal-body">
                                        {%if item.d_password%}
                                        <h6>
                                            密码：<code>{{item.d_password}}</code>
                                        </h6>
                                        {%endif%}
                                        <div class="alert alert-primary mb-0" role="alert">
                                            点击下载无响应？ 是因为浏览器阻止了弹出窗口，网址输入框的最右边有个图标，点击后允许即可！
                                        </div>
                                    </div>

                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                                        <a href="{{item.d_url}}" type="button" class="btn btn-primary"
                                            target="_blank">点击下载</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                        {%endfor%}
                        <!-- /specifications -->
                        {% if detail.description %}
                        <div
                            class="p-2 mt-3 bg-primary-soft border-start border-end border-primary border-2 text-white rounded-xl">
                            <h3 class="h6">简介</h3>
                            <div class="small">
                                {{detail.description}}
                            </div>
                        </div>
                        {%endif%}

                    </div>


                </div>

                {%endif%}
                <p class="text-muted border-bottom pb-2 small mt-5">
                    最后更新时间: {{helper.moment(detail.updatedAt).format('YYYY-MM-DD HH:mm:ss')}}
                </p>
                {%set tags = detail.tags|split(',')%}
                {%if tags%}
                <!-- Tags and share -->
                <div class="row">
                    <div class="col-12">

                        <h4 class="smaller text-muted">
                            相关标签
                        </h4>
                        {%for item in tags%}
                        <a href="#!" class="text-dark bg-light small rounded py-2 px-3 m-1 text-decoration-none"
                            rel="nofollow">
                            {{item}}
                        </a>
                        {%endfor%}
                    </div>
                </div>
                <!-- /Tags and share -->
                {%endif%}



                <!-- COMMENTS -->
                {%if detail.cms_classify.reply%}
                {% include "./comment_index.html" %}
                {%endif%}
                <!-- /COMMENTS -->







            </div>

            <div class="col-lg-3 order-1 mb-3">
                <!-- SEARCH -->
                <form method="get" action="{{detail.classify_url}}" class="input-group-over d-block mb-2">

                    <div class="form-floating mb-3">
                        <input required placeholder="内容搜索..." id="blog_search" name="keywords" type="text" class="form-control">
                        <label for="blog_search">内容搜索...</label>
                    </div>

                    <button type="submit" class="btn smaller">
									<i class="fi fi-search m-0"></i>
								</button>

                </form>
                <!-- /SEARCH -->
                <!-- CATEGORIES -->
                <nav
                    class="sticky-kit z-index-0 nav-deep nav-deep-light nav-deep-hover nav-deep-xs mb-3 pb-3 shadow-xs shadow-none-md shadow-none-xs p-0-md p-0-xs rounded">
                    <!-- mobile trigger : categories -->
                    <button
	class="clearfix btn btn-toggle btn-sm w-100 text-align-left shadow-md border rounded mb-1 d-block d-lg-none"
	data-bs-target="#nav_responsive"
	data-toggle-container-class="d-none d-sm-block bg-white shadow-md border animate-fadein rounded"
>
	<span class="group-icon px-2 py-2 float-start">
		<i class="fi fi-bars-2"></i>
		<i class="fi fi-close"></i>
	</span>
	<span class="h5 py-2 m-0 float-start"> 目录 </span>
</button>

                    <!-- desktop only -->
                    <h5 class="p-3 m-0 d-none d-lg-block">目录</h5>

                    <!-- navbar : navigation -->
                    <ul id="nav_responsive" class="nav flex-column d-none d-lg-block">
                        {%set nav =
                        'cms_doc'|@findAll({where:{classify_id:detail.cms_classify.id,pid:0,status:1},order:[[ 'sort',
                        'ASC' ]]})%}
                        {%for n in nav%}
                        {%set _nav =
                        'cms_doc'|@findAll({where:{classify_id:detail.cms_classify.id,pid:n.id,status:1},order:[[
                        'sort', 'ASC' ]]})%}
                        {%if _nav|length>0%}
                        <li class="nav-item {%if (n.id in (pdocids or []))%}active{%endif%}">
                            <a class="nav-link" href="#">
                                <span class="group-icon float-end">
				<i class="fi fi-arrow-end-slim"></i>
				<i class="fi fi-arrow-down-slim"></i>
			</span>
                                {{n.title}}
                            </a>
                            <ul class="nav flex-column ps-3">
                                {%for _n in _nav%}
                                {%set __nav =
                                'cms_doc'|@findAll({where:{classify_id:detail.cms_classify.id,pid:_n.id,status:1},order:[[
                                'sort', 'ASC' ]]})%}
                                {%if __nav|length>0%}
                                <li class="nav-item {%if (_n.id in (pdocids or []))%}active{%endif%}">
                                    <a class="nav-link" href="#">
                                        <span class="group-icon float-end">
						<i class="fi fi-arrow-end-slim"></i>
						<i class="fi fi-arrow-down-slim"></i>
					</span>
                                        {{_n.title}}
                                    </a>
                                    <ul class="nav flex-column">
                                        {%for __n in __nav%}
                                        <li class="nav-item {%if __n.id == detail.id%}active{%endif%}"><a
                                                class="nav-link" href="/cms/detail/{{__n.id}}">{{__n.title}}</a></li>
                                        {%endfor%}
                                    </ul>
                                </li>
                                {%else%}
                                <li class="nav-item {%if _n.id == detail.id%}active{%endif%}"><a class="nav-link"
                                        href="/cms/detail/{{_n.id}}">{{_n.title}}</a></li>
                                {%endif%}
                                {%endfor%}
                            </ul>
                        </li>
                        {%else%}
                        <li class="nav-item  {%if n.id ==detail.id%}active{%endif%}"><a class="nav-link"
                                href="/cms/detail/{{n.id}}">{{n.title}}</a></li>
                        {%endif%}
                        {%endfor%}
                    </ul>
                </nav>
                <!-- /CATEGORIES -->
            </div>
        </div>
    </div>
</div>
<!-- end :: blog content -->

{% endblock %}
{%block script%}
<script>
    //评论
  var cms_comments_callback = function(from,data){
		if(data.status===1000){
          $.SOW.core.toast.show('danger', 'Error', data.msg, 'top-end');
        }else{
          $.SOW.core.toast.show('success', 'Success', data.msg, 'top-end');
          $(from).find('[name="content"]').empty()
					$.SOW.core.ajax_content.__ajaxDivProcess('cms_comments_container', '/cms/comments/ajaxList?doc_id={{detail.id}}', '#cms_comments_container',$.SOW.core.ajax_content.config.method,null,$.SOW.core.ajax_content.config.callback_function,$.SOW.core.ajax_content.config.callback_before_push);
        }
	}
	var cms_comments_reply_callback = function(from,data){
		if(data.status===1000){
          $.SOW.core.toast.show('danger', 'Error', data.msg, 'top-end');
        }else{
          $.SOW.core.toast.show('success', 'Success', data.msg, 'top-end');
          $(from).find('[name="content"]').empty()
					$('#sow_ajax_modal').modal('hide');
					$.SOW.core.ajax_content.__ajaxDivProcess('cms_comments_container', '/cms/comments/ajaxList?doc_id={{detail.id}}&page='+data.data, '#cms_comments_container',$.SOW.core.ajax_content.config.method,null,$.SOW.core.ajax_content.config.callback_function,$.SOW.core.ajax_content.config.callback_before_push);
        }
	 }
</script>
{%endblock%}